// 引入路由模块
const { Router } = require('express')
// 创建一个路由实例
const router = new Router()

// 引入jwt生成模块
const { overToken, verifyToken } = require('../../utils/verification')

// 退出登录
router.post('/logout',function (request, response) {
    const token = request.get('permission')
    const decryptToken = verifyToken(token)
    const overDeal = overToken(decryptToken)
    let data = {
        code: '200',
        msg: '退出成功',
        data: 'success'
    }
    if (!overDeal){
        data.data = 'error'
        data.msg = '退出失败'
    }
    response.json(data)
})

module.exports = router
